package com.youthfilmic.yuejian.util;

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;


/**
 * @title 微信通知发送进程
 * @author bigtomato
 * @time 2015.7.1
 * */
public class SpringThreadPool {
	
	private static ThreadPoolTaskExecutor poolTaskExecutor = null;
	
	public static void init(){
		if (poolTaskExecutor == null){
			poolTaskExecutor = new ThreadPoolTaskExecutor();  
			//线程池所使用的缓冲队列  
			poolTaskExecutor.setQueueCapacity(20000);  
			//线程池维护线程的最少数量  
			poolTaskExecutor.setCorePoolSize(100);  
			//线程池维护线程的最大数量  
			poolTaskExecutor.setMaxPoolSize(1000);  
			//线程池维护线程所允许的空闲时间  
			poolTaskExecutor.setKeepAliveSeconds(30000);  
			poolTaskExecutor.initialize();
		}
	}

	public static void addThread(Thread thread){
		init();
		poolTaskExecutor.execute(thread);
	}
}



